package com.sgl.blog.pojo;

/**
 * @标题：
 * @内容：
 * @作者： 宋志豪
 */
public class RestfulBuilder {

    public static <T> Restful<T> successNoData(ResultCode code){
        Restful<T> result = new Restful<T>();
        result.setCode(code.getCode());
        result.setMessage(code.getMsg());
        return result;
    }

    //成功，返回数据
    public static <T> Restful<T> success(T t,ResultCode code){
        Restful<T> result = new Restful<T>();
        result.setCode(code.getCode());
        result.setMessage(code.getMsg());
        result.setData(t);
        return result;
    }

    //失败，返回失败信息
    public static <T> Restful<T> faile(ResultCode code){
        Restful<T> result = new Restful<T>();
        result.setCode(code.getCode());
        result.setMessage(code.getMsg());
        return result;
    }

}
